import React, { Component } from 'react';
import { MoreOutline, LeftOutline } from 'antd-mobile-icons'
import services from '../api/interface'
import { Button, Space, Toast } from 'antd-mobile'
class Register extends Component {
    state = {
        tel: ''
    }
    onClick() {
       
        this.props.history.go(-1)
    }
    async  next() {
        var res = await services.user.user_docheckphone({tel:this.state.tel})
        if(res.data.code==200){
            this.props.history.push({pathname:'/rpassword',state:{tel:this.state.tel}})
        }else if(res.data.code==10005){
            Toast.show({
                icon: 'fail',
                content: '重复注册！',
              })
        }
    }
    onchange(e) {
        this.setState({
            tel: e.target.value
        })
    }
    render() {
        return (
            <div className='register'>
                <div className='dnavbar'>
                    <span onClick={() => { this.onClick() }}><LeftOutline /></span>
                    <div>注册</div>
                    <div className='dmicon'>

                    </div>
                </div>
                <div className="lcontent">
                    <input type="text" placeholder='请输入手机号' value={this.state.tel} onChange={(e) => {
                        this.onchange(e)
                    }} />
                    <button onClick={() => { this.next() }} >下一步</button>
                </div>
            </div>
        );
    }
}

export default Register;